package com.cloud.train.business.controller.admin;

import com.cloud.train.business.domain.DailyTrainTicket;
import com.cloud.train.business.req.DailyTrainTicketQueryReq;
import com.cloud.train.business.req.DailyTrainTicketSaveReq;
import com.cloud.train.business.resp.DailyTrainTicketQueryResp;
import com.cloud.train.business.service.DailyTrainTicketService;
import com.cloud.train.common.resp.CommonResp;
import com.cloud.train.common.resp.PageResp;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/daily-train-ticket")
public class DailyTrainTicketAdminController {
    @Resource
    private DailyTrainTicketService dailyTrainTicketService;
//    @PostMapping("/save")
//    public CommonResp<Object> save(@Valid @RequestBody  DailyTrainTicketSaveReq req){
//        dailyTrainTicketService.save(req);
//        return new CommonResp<>();
//    }
    @GetMapping("/query-list")
    public CommonResp<PageResp<DailyTrainTicketQueryResp>> queryList(@Valid DailyTrainTicketQueryReq req){
        PageResp<DailyTrainTicketQueryResp> dailyTrainTicketQueryRespPageResp = dailyTrainTicketService.queryList(req);
        return new CommonResp<>(dailyTrainTicketQueryRespPageResp);
    }
    @DeleteMapping("/delete/{id}")
    public CommonResp<Object> delete(@PathVariable long id){
        dailyTrainTicketService.delete(id);
        return new CommonResp<>();
    }
}
